home *** CD-ROM | disk | FTP | other *** search
- **********
- Topic 31 Thu Mar 26, 1987
- M.OMASSEY at 18:30 PST
- Sub: output to printer info needed in c
-
- I'm new to c, just afew months, I have Megamax and don't understand how to
- send output to printer. like the Lprint in basic statment. Please help..I have
- looked at many books. no one seems to cover it.
- 4 message(s) total
- **********
- ----------
- Category 3, Topic 31
- Message 1 Mon Mar 30, 1987
- TEDMILLER at 02:20 EST
-
- You will have to write a procedure to do it yourself using BIOS calls or
- GEMDOS calls. try this (I have never had to do this, so I am not sure if it
- will work!)
-
- print(string,length) char *string; int length; { int i; for (i=0 ; i<length ;
- i++)
- {
- do {} while (Cprnos==0);
- Cprnout((char)(string[i]));
- } } This might print a string of length length. Good luck.
- ----------
- Category 3, Topic 31
- Message 2 Thu Apr 02, 1987
- JWEAVERJR [FactProg] at 15:47 EST
-
- easier way:
-
- print(string, length)
- *string; int length; {
- while (length--)
- {
- Cprnout(*string++);
- } }
-
- -JWJr
- ----------
- Category 3, Topic 31
- Message 3 Fri Apr 03, 1987
- TIMPURVES [Turbo_tim] at 23:41 EST
-
- or even easier print(string) char *string; {
- while(*string)
- printc(*string++); }
-
- printc(ch) int ch; {
- if(ch == '\n')
- printc('\r'); /* convert \n to \r\n on the fly! */
- bios(3,0,ch); /* bios bconout to printer */ }
-
- /* use printc() for a character
- use print() for a string
- */
- ----------
- Category 3, Topic 31
- Message 4 Thu May 21, 1987
- E.C0LLINS at 19:08 PDT
-
- To use the printer from LATTICE C, all you have to do is open a file and use
- fprintf or fputs instead of printf or puts. For example:
-
- print(string)
- {
- FILE *fopen,*fp;
-
- fp = fopen("LST:","w"); /* open the printer for writing */]
- fputs(string,fp);
- fclose(fp);
- }
- ----------
-